package xdj.android.personal.namespace.Business;

import java.util.ArrayList;
import java.util.List;

import xdj.android.personal.namespace.Entity.LineEntity;
import android.content.Context;
import android.database.Cursor;

public class LineDBAccess extends BaseDBAccess<LineEntity, LineEntity>
{

	Context _context;
	MyDataBaseHelper dBaseHelper;

	public LineDBAccess(Context context)
	{
		_context = context;
		dBaseHelper = DBAccessHelper.DownloadDataBase(context);
	}

	@Override
	public Boolean OpenConnection(String path)
	{
		// TODO Auto-generated method stub
		return super.OpenConnection(path);
	}

	@Override
	public Boolean CLoseConnection()
	{
		// TODO Auto-generated method stub
		return super.CLoseConnection();
	}

	@Override
	public int Insert(List<LineEntity> modeList)
	{
		// TODO Auto-generated method stub
		return super.Insert(modeList);
	}

	@Override
	public Boolean Query(LineEntity para)
	{
		// TODO Auto-generated method stub

		return super.Query(para);
	}

	@Override
	public LineEntity GetOneQueryResult()
	{
		// TODO Auto-generated method stub
		return super.GetOneQueryResult();
	}

	@Override
	public List<LineEntity> GetAllQueryResults()
	{
		List<LineEntity> list;
		try
		{
			String sql = "SELECT Line_Id,Line_Name,Line_Order,Line_Type,Memo from Lines";
			Cursor _cursor = dBaseHelper.getReadableDatabase().rawQuery(sql,
					null);
			list = null;
			if (_cursor.moveToFirst())
			{
				list = new ArrayList<LineEntity>();
				do
				{
					LineEntity lineEntity = new LineEntity();
					lineEntity.ID = _cursor.getString(_cursor
							.getColumnIndex("Line_Id"));
					lineEntity.Name = _cursor.getString(_cursor
							.getColumnIndex("Line_Name"));
					lineEntity.Line_Order = _cursor.getInt(_cursor
							.getColumnIndex("Line_Order"));
					lineEntity.Line_Type = _cursor.getInt(_cursor
							.getColumnIndex("Line_Type"));
					lineEntity.Memo = _cursor.getString(_cursor
							.getColumnIndex("Memo"));
					list.add(lineEntity);
				} while (_cursor.moveToNext());
			}
			_cursor.close();

			return list;
		} catch (Exception e)
		{
			// TODO: handle exception
			e.printStackTrace();
			return null;
		}

	}

	@Override
	public int Delete(List<LineEntity> paraList)
	{
		// TODO Auto-generated method stub
		return super.Delete(paraList);
	}

	@Override
	public int Update(List<LineEntity> paraList)
	{
		// TODO Auto-generated method stub
		return super.Update(paraList);
	}

	@Override
	public Boolean DeleteTableData(String tableName)
	{
		// TODO Auto-generated method stub
		return super.DeleteTableData(tableName);
	}

	@Override
	protected Object clone() throws CloneNotSupportedException
	{
		// TODO Auto-generated method stub
		return super.clone();
	}

	@Override
	public boolean equals(Object o)
	{
		// TODO Auto-generated method stub
		return super.equals(o);
	}

	@Override
	protected void finalize() throws Throwable
	{
		// TODO Auto-generated method stub
		super.finalize();
	}

	@Override
	public int hashCode()
	{
		// TODO Auto-generated method stub
		return super.hashCode();
	}

	@Override
	public String toString()
	{
		// TODO Auto-generated method stub
		return super.toString();
	}

}
